package cn.xzc.job.throwable;


import cn.xzc.job.util.StringUtils;
import cn.xzc.job.util.ThrowableUtil;

public class UtilException extends RuntimeException {
    private static final long serialVersionUID = 8247610319171014183L;

    private String code;
    public void setCode(final String code) {
        this.code = code;
    }
    public String getCode() {
        return this.code;
    }
    public UtilException(String code, String message) {
        super(message);
        this.setCode(code);
    }
    public UtilException(Throwable e) {
        super(ThrowableUtil.getThrowableMessage(e), e);
    }

    public UtilException(String message) {
        super(message);
    }

    public UtilException(String messageTemplate, Object... params) {
        super(StringUtils.format(messageTemplate, params));
    }

    public UtilException(String message, Throwable throwable) {
        super(message, throwable);
    }

    public UtilException(Throwable throwable, String messageTemplate, Object... params) {
        super(StringUtils.format(messageTemplate, params), throwable);
    }
}